import { FileItem } from "ng2-file-upload";
import { Observable } from "rxjs";

export interface MultipartUploadOption{

    uploadedCallback(fileItem: any):void;

    singleUploaderOnBuildItemForm(fileItem: FileItem, form: any):void;

    partUploaderUrl:string;
    uploaderUrl:string;
    verifyFunction:(paras: any) => Observable<any>;
    getVerifyInput:(fileContainer: ChunkContainer)=>any;
    getMergeRequestInput:()=>any;
    mergeRequestFunction:(paras: any) => Observable<any>;
}

//this.container.file.name, size = file.size;
export interface ChunkContainer {
    file: any;
    hash: string;
    dimensions: string;
    exName: string;
    dataUrl: string,
    icon: string,
    isImage: boolean,
    fileSizeStr: string,
    isMultiPartUpload: boolean,
    customData: { [key:string]: any};
    //replaceFileId: number;
    //pathItem: IPathItem;
}

export interface FileChunk {
    size: number;
    progress: number;
    hash: string;
    index: number;
    fileHash: string;
    status: Status;
    startCur: number;
    endCur: number;
}

export enum Status {
    wait = "wait",
    pause = "pause",
    uploading = "uploading",
    error = "error",
    reject = "reject",
    done = "done"
};
